<script type="text/javascript">
	$.metadata.setType("attr", "validate");
	$().ready(function() {
		$("#add").validate();
	});
</script>

<!-- phần nội dung quản lý - bên phải -->
<div id="content-right">
	<div id="add-product">
		<div id="sidebar-top-product" class="black">
			<div id="img-product" class="left white">
				 <?php echo $title?>
			</div>
			<div id="img-back" class="right white">
				<a class="white" href="javascript:;" onclick="history.go(-1)">Quay lại trang trước</a> 
			</div>
			<div class="clear">
			</div>
		</div>
		<div class="form-product">
			<form  action="" method="post" name="add" id="add">
				<?php if (isset($_SESSION['error_add']) && !empty($_SESSION['error_add'])){?>
					<div class="form-add" align="center">
						<?php echo '<font style="color:red; text-align:center; font-size:15px;">'.$_SESSION['error_add'].'</font>'?>
					</div>
	        	<?php }$_SESSION['error_add'] = NULL;?>
				<div style="float: left; width: 50%;">
					<?php echo $_SESSION['cat_id']?>
					<div class="form-add">
						<label class="left black">Category</label>
						<select class="selectText" name="cat_id">
							<option value="0">Danh mục cha</option>
							<option value="" disable="disable">-----------------------------</option>
							<?php foreach ($menu_admin as $menu){?>
								<option value="<?php echo 'cat1_'.$menu['id']?>" <?php if (isset($_SESSION['cat_id']) && !empty($_SESSION['cat_id'])) {if ($_SESSION['cat_id'] == $menu['id']) echo 'selected=selected';}?>><?php echo $menu['name']?></option>
								<?php foreach ($categories as $category){?>
									<?php if ($category['cat_id'] == $menu['id']){?>
										<option value="<?php echo 'cat2_'.$category['id']?>" <?php if (isset($_SESSION['cat_id']) && !empty($_SESSION['cat_id'])) {if ($_SESSION['cat_id'] == $category['id']) echo 'selected=selected';}?>><?php echo '++'.$category['name']?></option>
										<?php foreach ($categories as $category3){?>
											<?php if ($category3['cat_id'] == $category['id']){?>
												<option value="<?php echo 'cat3_'.$category3['id']?>" <?php if (isset($_SESSION['cat_id']) && !empty($_SESSION['cat_id'])) {if ($_SESSION['cat_id'] == $category3['id']) echo 'selected=selected';}?>><?php echo '+++'.$category3['name']?></option>
												<?php foreach ($categories as $category4){?>
													<?php if ($category4['cat_id'] == $category3['id']){?>
														<option value="<?php echo 'cat4_'.$category4['id']?>" <?php if (isset($_SESSION['cat_id']) && !empty($_SESSION['cat_id'])) {if ($_SESSION['cat_id'] == $category4['id']) echo 'selected=selected';}?>><?php echo '++++'.$category4['name']?></option>
													<?php }?>
												<?php }?>
											<?php }?>
										<?php }?>
									<?php }?>
								<?php }?>
							<?php }?>
						</select>
						<select class="selectText" name="cat_seo" id="cat_seo" style="display: none;">
							<?php foreach ($menu_admin as $menu_hidden){?>
								<option value="<?php echo $menu_hidden['first_name'].' '.$menu_hidden['last_name']?>"><?php echo $menu_hidden['name']?></option>
							<?php }?>
						</select>
					</div>
					<div class="form-add">
						<label class="left black">Category Name</label>
						<input type="text" name="name" id="name" />
					</div>
					<div class="form-add">
						<label class="left black">Image</label>
						<input placeholder="Chọn ảnh" name="image" type="text" id="image" class="required" />
						<a onclick="JavaScript:OpenFileManager('image','category');" href="javascript:"><b style="color:blue;">choose image</b></a>
					</div>
					
					<div class="form-add">
						<label class="left black">Status</label>
						<div class="check-option">
							<ul>
								<li><input type="radio" name="status" value="1" checked="checked" /> Yes</li>
								<li><input type="radio" name="status" value="0" /> No</li>
							</ul>
						</div>
					</div>					
				</div>
				<div style="float: left; width: 50%;">
					<div class="form-add">
						<label class="left black"></label>
						<input type="button" class="form-submit" value=" Tạo SEO " onclick="CreateTitleSEO();">
						<div class="bubble-left"></div>
						<div class="bubble-inner">Create SEO</div>
						<div class="bubble-right"></div>
					</div>
					<div class="clear"></div>
					<div class="form-add">
						<label class="left black">Meta Description</label>
						<textarea style="height: 80px;" maxlength="100" class="required" name="meta_description"></textarea>
					</div>
					<div class="form-add">
						<label class="left black">Meta Keyword</label>
						<textarea style="height: 80px;" maxlength="100" class="required" name="meta_keyword"></textarea>
					</div>
					<div class="form-add">
						<label class="left black">Meta Title</label>
						<textarea style="height: 50px;" maxlength="50" class="required" name="meta_title"></textarea>
					</div>
				</div>
				<div class="clear"></div>
				<div class="button-product">
					<input type="submit" class="save_add" name="cmd" value="Save & Add" style="color: #FFF; font-weight: bold; padding-bottom: 5px;"/>
					<input type="submit" class="submit-product" name="cmd" value="Add" style="margin-left: 15px; color: #FFF; font-weight: bold; padding-bottom: 5px;" />
					<input type="reset" class="reset-product"  value='Cancel' style="color: #FFF; font-weight: bold; padding-bottom: 5px;" />					
				</div>
			</form>                  
		</div>
	</div>
</div><!-- end  content-right -->